package ning.zhi.ze.activity;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatEditText;

import ning.zhi.ze.R;

public class New1Activity extends AppCompatActivity {

    private AppCompatEditText usernameEditText = null;
    private AppCompatEditText passwordEditText = null;
    private AppCompatButton registerTextView = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main1);

        usernameEditText = findViewById(R.id.usernameEditText);
        passwordEditText = findViewById(R.id.passwordEditText);
        registerTextView = findViewById(R.id.registerTextView);

        usernameEditText.setText(getIntent().getStringExtra("username"));

        registerTextView.setOnClickListener(view -> {
            Intent intent = new Intent();
            intent.putExtra("username", usernameEditText.getText().toString());
            intent.putExtra("password", passwordEditText.getText().toString());
            setResult(RESULT_OK, intent);
            finish();
        });

    }

}
